package org.divineryang.exception;

import lombok.Data;
import org.divineryang.model.vo.common.ResultCodeEnum;

/**
 * @program new-bee
 * @Description
 * @Author Diviner Yang
 * @Date 2024/04/19 9:20
 * @Version 1.0
 */
@Data
public class NewBeeException extends RuntimeException{
    private Integer code ;          // 错误状态码
    private String message ;        // 错误消息

    private ResultCodeEnum resultCodeEnum ;     // 封装错误状态码和错误消息

    public NewBeeException(ResultCodeEnum resultCodeEnum) {
        this.resultCodeEnum = resultCodeEnum ;
        this.code = resultCodeEnum.getCode() ;
        this.message = resultCodeEnum.getMessage();
    }

    public NewBeeException(Integer code , String message) {
        this.code = code ;
        this.message = message ;
    }
}
